<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head-fragment(title,path)">
    <meta charset="UTF-8">
    <title>小迪商城 XiaoDi-Mall</title>
    <script src="mall/js/jquery.min.js"></script>
    <link href="../mall/image/迪.png"rel="shortcut icon"type="image/x-icon">
    <link rel="stylesheet" th:href="@{/mall/css/swiper.min.css}">
    <link rel="stylesheet" th:href="@{/mall/css/iconfont.css}">
    <link rel="stylesheet" th:href="@{/mall/css/common.css}">
    <link rel="stylesheet" th:href="@{/mall/styles/header.css}">
    <link rel="stylesheet" th:href="@{'/mall/styles/'+${path}+'.css'}">
    <link rel="stylesheet" th:href="@{/admin/plugins/sweetalert/sweetalert.css}"/>
    <meta name="keywords" content="小米商城,starsea-mall,小米,商城,开源商城,starsea,企业级商城,大型商城项目,Java商城,springboot商城,SpringBoot商城项目,Spring Boot 大型线上商城项目实战教程" />
    <meta name="description" content="starsea-mall 项目（小米商城）是一套电商系统，包括 starsea-mall 商城系统及 starsea-mall-admin 商城后台管理系统，基于 Spring Boot 2.X 及相关技术栈开发。前台商城系统包含首页门户、商品分类、新品上线、首页轮播、商品推荐、商品搜索、商品展示、购物车、订单结算、订单流程、个人订单管理、会员中心、帮助中心等模块。后台管理系统包含数据面板、轮播图管理、商品管理、订单管理、会员管理、分类管理、设置等模块。Spring Boot 大型线上商城项目实战教程"/>
    <script>
        //获取城市
        $(function () {
            //发送ajax请求获取城市

            $.getJSON("/getCity",function (temp) {
                if (temp.resultcode==200){
                    //获取省份和城市
                    let province = temp.result.Province;
                    let city = temp.result.City;
                    $("#city").html(province+city);
                    //根据城市查询天气
                    $.getJSON("/getWeatherByCity",{"city":city},function (temp) {
                        let arr = temp.result.future;

                        for (let i = 0; i < arr.length; i++) {
                            var	nowTime=new Date()

                            var time=nowTime.toLocaleDateString();
                            time=time.replaceAll("/","-");
                            if(time==arr[i].date){
                                $("#weather").html(arr[i].date+","+arr[i].temperature+","+arr[i].weather);
                            }
                        }

                    })

                }else{
                    $("#city").html("网络异常");
                }
            })
        })


    </script>
</head>

<nav id="nav" th:fragment="nav-fragment">
    <div class="banner_x center">
        <a th:href="@{/index}" class="logo"><h1>小米商城</h1></a>
        <div class="fr">
            <div class="search">
                <input class="text" type="text" id="keyword" autocomplete="off">
                <div class="search_hot">
                </div>
            </div>
            <div class="button iconfont icon-search" onclick="search()"></div>
        </div>
    </div>
</nav>

<header id="header" th:fragment="header-fragment">
    <div class="center">
        <ul class="fl">
            <li><a th:href="@{/index}">小迪商城</a></li>
            <li><a th:href="@{/toAdminLogin}">后台管理系统</a></li>
            <li><a th:href="@{/toWeChat}">联系方式</a></li>
            <li><a href="#"></a></li>
        </ul>
        <div class="fr">
            <th:block th:unless="${session.newBeeMallUser==null}">
                <div class="user">
                    <ul class="selector">
                        <li>
                            <a th:href="@{/personal}">
                                个人中心
                            </a>
                        </li>
                        <li>
                            <a th:href="@{/orders}">
                                我的订单
                            </a>
                        </li>
                        <li>
                            <a th:href="@{/logout}">
                                退出登录
                            </a>
                        </li>
                    </ul>
                    <a href="##" class="username">
                        <th:block th:text="${session.newBeeMallUser.nickName}"></th:block>
                        <i class="iconfont icon-down"></i>
                    </a>
                </div>
                <div class="shopcart">
                    <a th:href="@{/shop-cart}" style="color: white;"><i class="iconfont icon-cart"></i>
                            购物车<!--(
                            <th:block th:text="${session.newBeeMallUser.shopCartItemCount}"></th:block>
                            )--></a>
                </div>
                <div id="content" style="width: 200px;
            height: 40px;
            float: right;
            margin-right: 5%;
            background-color: #EED2EE;
            background-image: url('http://localhost:8088/mall/image/1.png');">
                    <span id="city">显示城市</span>
                    <br>
                    <span id="weather">显示天气</span>
                </div>
            </th:block>
            <th:block th:if="${session.newBeeMallUser==null}">
                <ul class="login">
                    <li><a th:href="@{/login}">登录</a></li>
                    <li><a th:href="@{/register}">注册</a></li>
                </ul>
                <div class="shopcart">
                    <a href="##" style="color: white;"><i class="iconfont icon-cart"></i>
                        购物车</a>
                </div>
            </th:block>
        </div>
    </div>
</header>


</html>
